﻿#ifndef HRIBBONCONTEXTCATEGORY_H
#define HRIBBONCONTEXTCATEGORY_H
#include "HRibbonGlobal.h"
#include "HRibbonCategory.h"
#include <QWidget>
class HRibbonContextCategoryPrivate;


/**
 * @brief 管理上下文标签的类
 */
class HRIBBON_EXPORT HRibbonContextCategory : public QObject
{
    Q_OBJECT
public:
    HRibbonContextCategory(QWidget *parent = 0);
    ~HRibbonContextCategory();
    //上下文目录添加下属目录
    HRibbonCategory *addCategoryPage(const QString& title);

    //获取上下文标签下管理的标签个数
    int categoryCount() const;

    //设置id
    void setId(const QVariant& id);
    QVariant id() const;

    //设置上下文颜色
    void setContextColor(const QColor color);
    QColor contextColor() const;

    //上下文标签的内容
    QString contextTitle() const;
    void setContextTitle(const QString& contextTitle);

    //获取对应的tab页
    HRibbonCategory *categoryPage(int index);

    //获取所有的HRibbonCategory*
    QList<HRibbonCategory *> categoryList() const;

    //移除category
    bool takeCategory(HRibbonCategory *category);

signals:
    void categoryPageAdded(HRibbonCategory *category);
    void categoryPageRemoved(HRibbonCategory *category);

protected:
    //获取父级窗口
    QWidget *parentWidget() const;
    virtual bool eventFilter(QObject *watched, QEvent *e) override;

private:
    HRibbonContextCategoryPrivate *m_d;
};

#endif // HRIBBONCONTEXTCATEGORY_H
